package org.example.wx_springboot.service.impl;

import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.example.wx_springboot.controller.request.DeliveryRequest;
import org.example.wx_springboot.entity.Commodity;
import org.example.wx_springboot.entity.Delivery;
import org.example.wx_springboot.mapper.CommodityMapper;
import org.example.wx_springboot.mapper.DeliveryMapper;
import org.example.wx_springboot.service.IDeliveryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class DeliveryService implements IDeliveryService {

    @Autowired
    DeliveryMapper deliveryMapper;


    @Override
    public List<Delivery> list() {
        return deliveryMapper.list();
    }

    @Override
    public void save(Delivery delivery) {
        deliveryMapper.save(delivery);
    }

    @Override
    public void update(Delivery obj) {
        deliveryMapper.updateById(obj);
    }

    @Override
    public void deleteById(Integer id) {
        deliveryMapper.deleteById(id);
    }

    @Override
    public PageInfo<Delivery> page(DeliveryRequest deliveryPageRequest) {
        List<Delivery> delivery = deliveryMapper.listDelivery(deliveryPageRequest);
        return new PageInfo<>(delivery);
    }
}
